--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_saigyouji_yuyuko = General:new(extension, "hy_saigyouji_yuyuko", "chi_k", 4, 4, General.Female)
    local walk_to_dead = fk.CreateSkill {
        name = "walk_to_dead",
    }
    walk_to_dead:addEffect(fk.Damaged, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(walk_to_dead.name) and target ~= player and #player.player_cards[Player.Hand] >= 2 and player:usedSkillTimes(walk_to_dead.name, Player.HistoryTurn) < 1 and not target.dead
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            local cards = room:askToDiscard(player, {
                min_num = 2,
                max_num = 2,
                skill_name = walk_to_dead.name,
                prompt = "walk_to_dead_prompt::" .. target.id,
                skip = true,
            })
            if #cards == 2 then
                event:setCostData(self, cards)
                return true
            end
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:throwCard(event:getCostData(self), walk_to_dead.name, player, player)
            room:damage({
                from = player,
                to = target,
                damage = 1,
                damageType = fk.NormalDamage,
                skillName = walk_to_dead.name,
            })
        end,
    })
    local butterfly_spear = fk.CreateSkill {
        name = "butterfly_spear",
    }
    butterfly_spear:addEffect(fk.CardUsing, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(butterfly_spear.name) and target == player and data.card and data.card.trueName == "slash"
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            if player.hp <= 2 then
                data.disresponsiveList = player.room.alive_players
            end
            if player.hp <= 1 then
                data.additionalDamage = (data.additionalDamage or 0) + 1
            end
        end,
    })
    butterfly_spear:addEffect("targetmod", {
        bypass_distances = function(self, player, skill, card, to)
            return player:hasSkill(butterfly_spear.name) and player.hp <= 3 and skill.trueName == "slash_skill"
        end
    })
    butterfly_spear:addEffect("filter", {
        card_filter = function(self, card, player)
            return player:hasSkill(butterfly_spear.name) and card.name == "peach" and player.hp > 0
        end,
        view_as = function(self, player, card)
            local c = Fk:cloneCard("slash")
            c:addSubcard(card)
            return c
        end
    })
    butterfly_spear:addEffect("maxcards", {
        exclude_from = function(self, player, card)
            if player:hasSkill(butterfly_spear.name) and card and card.trueName == "slash" then
                return true
            end
        end,
    })
    local resurrect = fk.CreateSkill {
        name = "resurrect",
    }
    resurrect:addEffect(fk.EventPhaseStart, {
        anim_type = "drawcard",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(resurrect.name) and target == player and player.phase == Player.Finish and player.hp > 1
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:loseHp(player, 1, resurrect.name)
            if not player.dead then
                local cards = room:drawCards(player, 2, resurrect.name)
                local use = room:askToUseCard(player, {
                    skill_name = "slash",
                    pattern = "slash|.|.|.|.|.|" .. table.concat(cards, ","),
                    prompt = "resurrect_prompt",
                    extra_data = {
                        bypass_times = true,
                    }
                })
                if use then
                    room:useCard(use)
                end
            end
        end
    })
    extension:loadSkillSkels { walk_to_dead, butterfly_spear, resurrect }
    hy_saigyouji_yuyuko:addSkill("walk_to_dead")
    hy_saigyouji_yuyuko:addSkill("butterfly_spear")
    hy_saigyouji_yuyuko:addSkill("resurrect")
    Fk:loadTranslationTable {
        ["hy_saigyouji_yuyuko"] = "西行寺幽幽子",
        ["#hy_saigyouji_yuyuko"] = "黄泉冥蝶",
        ["illustrator:hy_saigyouji_yuyuko"] = "miy@",
        ["designer:hy_saigyouji_yuyuko"] = "黑曜人形",
        ["cv:hy_saigyouji_yuyuko"] = "",

        ["walk_to_dead"] = "死行",
        [":walk_to_dead"] = "每回合限一次，其他角色受到伤害后，你可以弃置两张手牌并对其造成1点伤害。",
        ["walk_to_dead_prompt"] = "死行：你可以弃置两张手牌并对%dest造成一点伤害",

        ["butterfly_spear"] = "蝶枪",
        [":butterfly_spear"] = "若你不处于濒死状态，你的【桃】视为【杀】。你的【杀】不计入手牌上限。若你的体力值：不大于3，你使用【杀】无距离限制；不大于2，你使用的【杀】无法被响应；不大于1，你使用的【杀】伤害+1。",

        ["resurrect"] = "反魂",
        [":resurrect"] = "结束阶段，若你的体力值大于1，你失去1点体力并摸两张牌，然后你可以使用其中一张【杀】。",
        ["resurrect_prompt"] = "反魂：你可以使用其中一张【杀】"
    }
end
